package util;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import scala.Long;

/**
 * @Author 李荣
 * @Date 2025/1/22
 * @Description
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class KeyUtil {
    private Integer id;
    private String key;
    //private Long threadId;

    //怎么添加key呢，通过id生成吗
    //添加了，怎么通过key取出来呢
    @Override
    public int hashCode() {
        return id.hashCode();
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == this) {
           return true;
        }

        if (obj == null || getClass() != obj.getClass())
        {
            return false;
        }

        KeyUtil keyUtil = (KeyUtil) obj;
        return this.getId().equals(keyUtil.getId()) && this.getKey().equals(keyUtil.getKey());
    }
}
